function log(val) {
    console.log(val);
}

var vm = new Vue({
    el: "#app",

    data: {
        items: [],
        itemsLen: '',
        MenuList: [],
        totalPageNum: [],
        pageSize: '',
        currentPageNum: '',
    },

    filters: {},

    computed: {},

    mounted: function () {
        this.getPager();
    },

    methods: {
        getPager: function (n) {
            this.$http.get("/api/CreateCode/getPager", {pageNum: n, pageSize: this.pageSize}).then(function (data) {
                this.totalPageNum = data.data.totalPageNum;
                this.pageSize = data.data.perPageSize;
                this.currentPageNum = data.data.currentPageNum;
                this.items = data.data.entitys;
            });
        },
        back: function () {
            if (this.currentPageNum != 1) {
                this.$http.get("/api/CreateCode/getPager", {
                    pageNum: this.currentPageNum - 1,
                    pageSize: this.pageSize
                }).then(function (data) {
                    this.totalPageNum = data.data.totalPageNum;
                    this.pageSize = data.data.perPageSize;
                    this.currentPageNum = data.data.currentPageNum;
                    this.items = data.data.entitys;
                });
            }
        },
        go: function () {
            if (this.currentPageNum < this.totalPageNum) {
                this.$http.get("/api/CreateCode/getPager", {
                    pageNum: this.currentPageNum + 1,
                    pageSize: this.pageSize
                }).then(function (data) {
                    this.totalPageNum = data.data.totalPageNum;
                    this.pageSize = data.data.perPageSize;
                    this.currentPageNum = data.data.currentPageNum;
                    this.items = data.data.entitys;
                });
            }
        },
        getTableFieldList: function (tableName) {
            location.href = "/table/tableFieldListView?tableName="+tableName;
        }
    }
});